/* Appendix */

****************
* Table 2      *
****************

* cd "G:\WHATEVER\FILEPATH\YOU\WANT"

eststo clear

set more off

/* Model 5 - Base model */
// basic probit to help with convergence
probit war ccp newpow contig mindemoc allied totalmids, nolog

matrix b0 = e(b)
local coln : colnames b0
foreach name of local coln {
	local colname "`colname' war:`name'"
	}
set more off

heckprob absout i.ccp##c.newpow bilat ww2 contig totalmids, ///
	sel(war=ccp newpow contig mindemoc allied totalmids) cluster(ndyadid) from(b0) nolog

	estimates store model5

/* Model 6 - drop WW2 */
// basic probit to help with convergence
probit war ccp newpow contig mindemoc allied totalmids if ww2dum == 0, nolog

matrix b0 = e(b)
local coln : colnames b0
foreach name of local coln {
	local colname "`colname' war:`name'"
	}
set more off

heckprob absout i.ccp##c.newpow bilat contig totalmids if ww2dum == 0, ///
	sel(war=ccp newpow contig mindemoc allied totalmids) cluster(ndyadid) from(b0) nolog
	
	estimates store model6

* Table 1 Output
estout model5 model6, ///
	cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) style(tab) ///
	stats(N, fmt(a1 %9.3f %9.3f)), using "absout_appendix3.txt"

********************
* Table 3          *
********************

* cd "G:\WHATEVER\FILEPATH\YOU\WANT"

eststo clear

set more off

/* Model 7 - no interaction */
// basic probit
probit war ccp newpow contig mindemoc allied totalmids, nolog

matrix b0 = e(b)
local coln : colnames b0
foreach name of local coln {
	local colname "`colname' war:`name'"
	}
set more off

heckprob absout ccp newpow bilat ww2 contig totalmids, ///
	sel(war=ccp newpow contig mindemoc allied totalmids) cluster(ndyadid) from(b0) nolog

	estimates store model7
	
/* Model 8 - both interaction */
// basic probit
probit war ccp newpow ccpxnewpow contig mindemoc allied totalmids, nolog

matrix b0 = e(b)
local coln : colnames b0
foreach name of local coln {
	local colname "`colname' war:`name'"
	}
set more off

heckprob absout ccp newpow ccpxnewpow bilat ww2 contig totalmids, ///
	sel(war=ccp newpow ccpxnewpow contig mindemoc allied totalmids) cluster(ndyadid) from(b0) nolog
	
	estimates store model8
	
/* Model 9 - Base model */
// basic probit to help with convergence
probit war ccp lnpower contig mindemoc allied totalmids, nolog

matrix b0 = e(b)
local coln : colnames b0
foreach name of local coln {
	local colname "`colname' war:`name'"
	}
set more off

heckprob absout i.ccp##c.lnpower bilat ww2 contig totalmids, ///
	sel(war=ccp lnpower contig mindemoc allied totalmids) cluster(ndyadid) from(b0) nolog

	estimates store model9

/* Model 10 - drop WW2 */
// basic probit to help with convergence
probit war ccp lnpower contig mindemoc allied totalmids if ww2dum == 0, nolog

matrix b0 = e(b)
local coln : colnames b0
foreach name of local coln {
	local colname "`colname' war:`name'"
	}
set more off

heckprob absout i.ccp##c.lnpower bilat contig totalmids if ww2dum == 0, ///
	sel(war=ccp lnpower contig mindemoc allied totalmids) cluster(ndyadid) from(b0) nolog
	
	estimates store model10

* Table 3 Output
estout model7 model8 model9 model10, ///
	cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) style(tab) ///
	stats(N, fmt(a1 %9.3f %9.3f)), using "absout_appendix1.txt"
	
*********************************	
/* Table 4 - Appendix 2        */
*********************************

* Note it is necessary to install the firthlogit add-on
* findit firthlogit

set more off

/* Model 11 - no selection all cases */
logit absout i.ccp##c.lnpower bilat ww2 contig totalmids, cluster(ndyadid) nolog

	estimates store model11

/* Model 12 - no selection drop ww2 */
logit absout i.ccp##c.lnpower bilat contig totalmids if ww2 == 0, cluster(ndyadid) nolog

	estimates store model12

/* Model 13 - firth logit all cases */
firthlogit absout i.ccp##c.lnpower bilat ww2 contig totalmids

	estimates store model13

/* Model 14 - firth logit drop ww2 */
firthlogit absout i.ccp##c.lnpower bilat contig totalmids if ww2 == 0

	estimates store model14

* Table 4 Output
estout model11 model12 model13 model14, ///
	cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) style(tab) ///
	stats(N, fmt(a1 %9.3f %9.3f)), using "absout_appendix2.txt"
